<template>
    <van-nav-bar title="标题" left-text="返回" left-arrow @click-left="$router.go(-1)" />
    <ul>
        <li v-for="item in list" :key="item.id" @click="$router.push('/shop')">
            <div><img style="width:100%" :src="item.image" alt=""></div>
            <p class="van-multi-ellipsis--l2">{{ item.title }}</p>
            <p style="color:red"> ￥{{ item.price }}</p>
        </li>
    </ul>
    <div style="display: flex;">
        <van-icon name="cart-o" color="#1989fa" />
        <van-submit-bar :price="3050" button-text="加入购物车" @submit="onSubmit" @click="$router.push('/login')">
  <van-checkbox v-model="checked">全选</van-checkbox>
  <template #tip>
    你的收货地址不支持配送, <span @click="onClickLink">修改地址</span>
  </template>
</van-submit-bar>
    </div>
  
</template>

<script setup>
import request from '@/utils/request'
import { ref, onMounted } from 'vue'
const list = ref({})
onMounted(() => {
    request.get('/list', {
        params: {
            pagination: 1,
            pageNum: 30
        }
    }).then(res => {
        if (res.data.code == 200) {
            list.value = res.data.data
        }
    })
}), {
    params: false
}

</script>

<style lang="scss" scoped>
ul {
    column-count: 2;

    li {
        break-inside: avoid;
    }
}
</style>